<script setup>
import Home from '@/views/home/index.vue'
import Layout from '@/layout/index.vue';
import useQuestionStore from '@/store/question';
import { storeToRefs } from 'pinia';

const questionStore = useQuestionStore()
const { sortBy, page, limit } = storeToRefs(questionStore)
const { getQuestionList } = questionStore

getQuestionList({ page: page.value, limit: limit.value, sortBy: sortBy.value })
const onClickSort = (sortBy) => getQuestionList({ page: page.value, limit: limit.value, sortBy })
const onPageChange = (page) => getQuestionList({ page, limit: limit.value, sortBy: sortBy.value })
</script>

<template>
  <Layout>
    <!-- <Filter /> -->
    <Home @clickSort="onClickSort" @pageChange="onPageChange" />
  </Layout>
</template>